home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / DATABASE / DE-BASE.ZIP;1 / DE-BASE.BAS (.txt) next >
Encoding:
GW-BASIC  |  1980-01-01  |  7.1 KB  |  169 lines

  1. 10  CLS : KEY OFF : LET Z=0 : COLOR 12,1,0
  2. 20  DIM T$(100),C1$(100),C2$(100),C3$(100)
  3. 30  REM Jared Brogni
  4. 40  'Loading Intro And To Main Menu
  5. 50  DEF SEG=&HB800
  6. 60  BLOAD "b:OPEN.DAT",0
  7. 70  A$=INKEY$ : IF A$="" THEN 70
  8. 80  DEF SEG=&HB800
  9. 90  BLOAD "b:DS.DAT",0
  10. 100  A$=INKEY$ : IF A$="" THEN 100
  11. 110  CLS : SOUND 400,1
  12. 120  DEF SEG=&HB800
  13. 130  BLOAD "b:MAIN.DAT",0
  14. 140  LOCATE 23,29 : INPUT "Please Enter Your Choice";C
  15. 150  IF C=1 THEN 250  'Enter Data
  16. 160  IF C=2 THEN 460  'Sorting Menu
  17. 170  IF C=3 THEN 360  'List Current Base
  18. 180  IF C=4 THEN 960  'Print Current Base
  19. 190  IF C=5 THEN 1030 'Save
  20. 200  IF C=6 THEN 1140 'Load
  21. 210  IF C=7 THEN 1280 'Delete Current Base
  22. 220  IF C=8 THEN 1410 'Instructions
  23. 230  IF C=9 THEN END  'Quit for Now
  24. 240  GOTO 140
  25. 250  '****************Enter Data*********************
  26. 260  CLS : LOCATE 3,1
  27. 270  LET E=E+1
  28. 280  INPUT "Enter Title Column";T$(E)
  29. 285  IF LEN(T$(E)) > 19 THEN PRINT "Sorry, data is too long" : GOTO 280
  30. 290  INPUT "Enter Info for Column 1 (Hit Enter for None)";C1$(E)
  31. 295  IF LEN(C1$(E)) > 19 THEN PRINT "Sorry, data is too long" : GOTO 290
  32. 300  INPUT "Enter info for Column 2 (Hit Enter for None)";C2$(E)
  33. 305  IF LEN(C2$(E)) > 19 THEN PRINT "Sorry, data is too long" : GOTO 300
  34. 310  INPUT "Enter Info for Column 3 (Hit Enter for None)";C3$(E)
  35. 315  IF LEN(C3$(E)) > 19 THEN PRINT "Sorry, data is too long" : GOTO 310
  36. 320  PRINT : PRINT : INPUT "Enter More Data (Y/N)";YN$
  37. 330  IF E=100 THEN PRINT "Sorry, but you are not able to enter any more data."
  38. 340  IF YN$="Y" OR YN$="y" THEN 260
  39. 350  GOTO 110
  40. 360  '***************List Curretn Base***************
  41. 370  CLS : LET L=0
  42. 375  PRINT "Title" TAB(20) "Column 1" TAB(40) "Column 2" TAB(60) "Column 3"
  43. 377  PRINT "------------------------------------------------------------------------------"
  44. 380  FOR X=1 TO 100
  45. 390  IF T$(X)="" THEN 420
  46. 400  PRINT T$(X) TAB(20) C1$(X) TAB(40) C2$(X) TAB(60) C3$(X)
  47. 410  IF X/25=INT(X/25) THEN A$=INKEY$ : IF A$="" THEN 410
  48. 420  NEXT X
  49. 430  A$=INKEY$ : IF A$="" THEN 430
  50. 440  GOTO 110
  51. 460  '***************Sorting Menu********************
  52. 470  CLS : LOCATE 5,1
  53. 480  PRINT TAB(27)"De-Base Sort Menu"
  54. 490  PRINT : PRINT TAB(23)"<1> Sort Base By Title  olumn"
  55. 500  PRINT TAB(23)"<2> Sort Base By Column 1"
  56. 510  PRINT TAB(23)"<3> Sort Base By Column 2"
  57. 520  PRINT TAB(23)"<4> Sort Base By Column 3"
  58. 530  PRINT TAB(23)"<5> Quit to Main Menu"
  59. 540  PRINT : INPUT "                     Please Enter Your Choice";C
  60. 550  IF C=1 THEN 600 'Title Column
  61. 560  IF C=2 THEN 690 'Column 1
  62. 570  IF C=3 THEN 780 'Column 2
  63. 580  IF C=4 THEN 870 'Column 3
  64. 590  IF C=5 THEN 110 'Quit to main
  65. 600  '%%%%%Sort By Title Column%%%%%%
  66. 610  CLS : COLOR 28,1,0 : PRINT "Sorting Database, Please Hold..." : COLOR 12,1,0
  67. 620  FOR X=1 TO 99
  68. 630  FOR Y=X+1 TO 100
  69. 640  IF T$(X) < T$(Y) THEN 660
  70. 650  SWAP T$(X),T$(Y) : SWAP C1$(X),C1$(Y) : SWAP C2$(X),C2$(Y) : SWAP C3$(X),C3$(Y)
  71. 660  NEXT Y
  72. 670  NEXT X
  73. 680  GOTO 470
  74. 690  '%%%%%%%Sort BY Column 1%%%%%%%
  75. 700  CLS : COLOR 28,1,0 : PRINT "Sorting Database, Please Hold..." : COLOR 12,1,0
  76. 710  FOR X=1 TO 99
  77. 720  FOR Y=X+1 TO 100
  78. 730  IF C1$(X) < C1$(Y) THEN 750
  79. 740  SWAP T$(X),T$(Y) : SWAP C1$(X),C1$(Y) : SWAP C2$(X),C2$(Y) : SWAP C3$(X),C3$(Y)
  80. 750  NEXT Y
  81. 760  NEXT X
  82. 770  GOTO 470
  83. 780  '%%%%%%%%%%Sorty By Column 2%%%%%%%%%
  84. 790  CLS : COLOR 28,1,0 : PRINT "Sorting Database, Please Hold..." : COLOR 12,1,0
  85. 800  FOR X=1 TO 99
  86. 810  FOR Y=X+1 TO 100
  87. 820  IF C2$(X) < C2$(Y) THEN 840
  88. 830  SWAP T$(X),T$(Y) : SWAP C1$(X),C1$(Y) : SWAP C2$(X),C2$(Y) : SWAP C3$(X),C3$(Y)
  89. 840  NEXT Y
  90. 850  NEXT X
  91. 860  GOTO 470
  92. 870  '%%%%%%%%%%%Sort By Column 3%%%%%%%%%%
  93. 880  CLS : COLOR 28,1,0 : PRINT "Sorting Database, Please Hold..." COLOR 12,1,0
  94. 890  FOR X=1 TO 99
  95. 900  FOR Y=X+1 TO 100
  96. 910  IF C3$(X) < C3$(Y) THEN 930
  97. 920  SWAP T$(X),T$(Y) : SWAP C1$(X),C1$(Y) : SWAP C2$(X),C2$(Y) : SWAP C3$(X),C3$(Y)
  98. 930  NEXT Y
  99. 940  NEXT X
  100. 950  GOTO 470
  101. 960  '***************Print Current Base***************
  102. 970  CLS : COLOR 28,1,0 : PRINT "Database has been sent to the printer..." : COLOR 12,1,0
  103. 975  LPRINT "Tittle" TAB(20) "Column 1" TAB(40) "Column 2" TAB(60) "Column 3"
  104. 977  LPRINT "-----------------------------------------------------------------------------"
  105. 980  FOR X=1 TO 100
  106. 990  IF T$(X)="" THEN 1010
  107. 1000  LPRINT T$(X) TAB(20) C1$(X) TAB(40) C2$(X) TAB(60) C3$(X)
  108. 1010  NEXT X
  109. 1020  GOTO 110
  110. 1030  '************Save Current Base***********
  111. 1040  CLS : PRINT : INPUT "What do you want to save your current base as";FILE$
  112. 1050  PRINT : PRINT "Okay, saving as "FILE$
  113. 1060  OPEN "O",#1,FILE$
  114. 1070  FOR X=1 TO 100
  115. 1080  WRITE #1,T$(X),C1$(X),C2$(X),C3$(X)
  116. 1090  NEXT X
  117. 1100  CLOSE #1
  118. 1110  PRINT : PRINT FILE$;" has been saved.  Press any key to continue."
  119. 1120  A$=INKEY$ : IF A$="" THEN 1120
  120. 1130  GOTO 110
  121. 1140  '**************Load File to Current Base***********
  122. 1150  CLS : PRINT : INPUT "WARNING!!!  Your current Data-Base will be deleted if you use this function.  Continue with function [y/n]";YN$
  123. 1160  IF YN$="y" THEN 1190
  124. 1170  IF YN$="n" THEN 110
  125. 1180  GOTO 1150
  126. 1190  CLS : PRINT : INPUT "Enter the file that you would like to load";FILE$
  127. 1200  OPEN "I",#1,FILE$
  128. 1210  FOR X=1 TO 100
  129. 1220  INPUT# 1,T$(X),C1$(X),C2$(X),C3$(X)
  130. 1230  NEXT X
  131. 1240  CLOSE #1
  132. 1250  PRINT : PRINT FILE$;" has been loaded.  Press any key to continue."
  133. 1260  A$=INKEY$ : IF A$="" THEN 1260
  134. 1270  GOTO 110
  135. 1280  '**************Delete Current Base*************
  136. 1290  CLS : PRINT : INPUT "WARNING!!!  You are about to delete all of your inormation.  Continue [y/n]";YN$
  137. 1300  IF YN$="y" THEN 1330
  138. 1310  IF YN$="n" THEN 110
  139. 1320  GOTO 1290
  140. 1330  FOR X=1 TO 100
  141. 1340  LET T$(X)="" : LET C1$(X)="" : LET C2$(X)="" : LET C3$(X)=""
  142. 1350  NEXT X
  143. 1360  PRINT : PRINT "Your database has been deleted.  Press any key to continue..."
  144. 1370  A$=INKEY$ : IF A$="" THEN 1370
  145. 1380  GOTO 110
  146. 1400  '*******************Instructions for the Mind**************
  147. 1410  CLS : PRINT : PRINT "     De-Base is a very simple database program with many useful functions.  It  should be pretty easy to use and sometimes self-explanetory, but this section   was added in case you needed help.  This help file is broken up into
  148. 1420  PRINT "These sections are made from the options on the main menu.  But, first you have to know that, whenever the screen pauses for and you can't figure out why, hit any key to continue."
  149. 1430  PRINT : PRINT "SECTION I.  Enter Data"
  150. 1440  PRINT "     In the enter data section, you are given the option to enter data for four different columns.  Each column is 19 characters long.  Also, you are allowed a maximum of 100 rows.  After entering for one row, you are then asked if you want";
  151. 1450  PRINT "to enter another row.  If you say no, you will be able to enter some more to the same database later without any problems."
  152. 1460  PRINT : PRINT "SECTION II.  Sort Menu"
  153. 1470  PRINT "     This option brings you to another menu wich has the following five options: Sort by title, sort by column 1, sorty by column 2, sorty by column 3 and quit to main menu.  These options sort your database by the different columns by"
  154. 1480  PRINT "alphabetical order."
  155. 1490  A$=INKEY$ : IF A$="" THEN 1490
  156. 1495  CLS
  157. 1500  PRINT : PRINT "Section III.  List Current Base
  158. 1510  PRINT "     This function, simply lists the current database and pauses every 20 lines for easy reading.  Just hit any key to continue when it pauses."
  159. 1520  PRINT : PRINT "Section IV.  Print Current Base"
  160. 1530  PRINT "     This section, sends your database and its column headers to the printer.   Since the database is not set for printer pages, it might not print evenly on   each page."
  161. 1540  PRINT : PRINT "Section V.  Save Current Base"
  162. 1550  PRINT "     This option saves the current database that is in memory.  It will ask you for the Path and file name of the drive and file that you would like to save as.Example: B:\Test.dat.  If the file already exists, it will be deleted."
  163. 1560  PRINT : PRINT "Section VI.  Load a database"
  164. 1570  PRINT "     This option, loads a saved De-base file.  First, it will ask you if you    really want to do this, because it will erase anything that you have in memory. Then, it asks you to enter the path and filename of your base."
  165. 1580  PRINT : PRINT "Section VII.  Delete Current Base"
  166. 1590  PRINT "     This option, clears all the memory of anything you have entered into a     database."
  167. 1600  A$=INKEY$ : IF A$="" THEN 1600
  168. 1610  GOTO 130
  169.